package vn.allmobile.ambnews.data;

import android.provider.BaseColumns;

public final class DbSchema {
	public static final String DATABASE_NAME = "db_baomobi";
	public static final int DATABASE_VERSION = 2;
	public static final String SORT_ASC = " ASC";
	public static final String SORT_DESC = " DESC";
	public static final String[] ORDERS = {SORT_ASC,SORT_DESC};
	public static final int OFF = 0;
	public static final int ON = 1;
	public static final int ARTICLE_TYPE_HOT = 1;
	public static final int ARTICLE_TYPE_SYNC = 2;
	
	public static final class ArticleSchema implements BaseColumns {
		public static final String TABLE_NAME = "items";
		public static final String COLUMN_ID = "id";
		public static final String COLUMN_URL = "url";
		public static final String COLUMN_PAPER = "pp_id";
		public static final String COLUMN_CATEGORY = "cat_id";
		public static final String COLUMN_TYPE = "type";
		public static final String COLUMN_TITLE = "title";
		public static final String COLUMN_DESCRIPTION = "description";
		public static final String COLUMN_IMAGE = "image";
		public static final String COLUMN_IMAGE_WIDTH = "img_width";
		public static final String COLUMN_IMAGE_HEIGHT = "img_height";
		public static final String COLUMN_DATE = "date";
		public static final String COLUMN_ISREAD = "is_read";
		public static final String COLUMN_CONTENT = "content";
		
		//public static  final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_URL + " TEXT NOT NULL," + COLUMN_HOMEPAGE + " TEXT NOT NULL," + COLUMN_TITLE + " TEXT NOT NULL," + COLUMN_TYPE + " TEXT," + COLUMN_REFRESH + " INTEGER," + COLUMN_ENABLE + " INTEGER NOT NULL);";
		public static final String CREATE_TABLE = "CREATE  TABLE " + TABLE_NAME + " (" + COLUMN_ID + " CHAR PRIMARY KEY  NOT NULL  UNIQUE , " + COLUMN_TITLE + " TEXT, " + COLUMN_DESCRIPTION + " TEXT, " + COLUMN_PAPER + " CHAR, " + COLUMN_CATEGORY + " CHAR, " + COLUMN_URL + " TEXT, " + COLUMN_CONTENT + " TEXT, " + COLUMN_IMAGE + " TEXT, " + COLUMN_IMAGE_WIDTH + " INTEGER DEFAULT 0, " + COLUMN_IMAGE_HEIGHT + " INTEGER DEFAULT 0, " + COLUMN_TYPE + " INTEGER, " + COLUMN_ISREAD + " BOOL DEFAULT 0, " + COLUMN_DATE + " DATETIME)";
		//
		
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
		
	}
	
	public static final class ChanelsSchema implements BaseColumns{
		public static final String TABLE_NAME = "chanels";
		public static final String COLUMN_PAPER = "pp_id";
		public static final String COLUMN_CATEGORY = "cat_id";
		public static final String COLUMN_LASTUPDATE = "last_update";
		
		public static final String CREATE_TABLE = "CREATE  TABLE " + TABLE_NAME + " (" + COLUMN_PAPER +  " CHAR NOT NULL   , "+ COLUMN_CATEGORY +" CHAR NOT NULL  , "+ COLUMN_LASTUPDATE +" INTEGER, PRIMARY KEY ("+ COLUMN_PAPER +", "+ COLUMN_CATEGORY +"))";
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
		
		
	}
}
